<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            position: relative;
            width: 100px;
        }

        .back-div {
            width: 100%;
            height: 200px;
            border: 3px solid #00f;
            background-color: #f00;
        }

        /* 
          前面的框框和后面的框框背景色一样
          设置背景色挡住后面的边框
          使用绝对定位和transform搭配居中展示
         */
        .front-div {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(0%,-50%);
            width: 100px;
            height: 20px;
            background-color: #f00;
            color: #fff;
        }
    </style>
</head>
<body>
    <div class="box">
        <div class="front-div">前面的文字</div>
        <div class="back-div"></div>
    </div>
</body>
</html>